The Helm Diff Plug-In
Learn how to use the Helm Diff plug-in.
We'll cover the following
The helm diff upgrade command#
The help diff upgrade command is the most widely used command when we’re developing a chart. It allows us to test how our changes will affect the existing Helm release.
Let’s say that we would like to add a new annotation to all Kubernetes resources. As we may remember, it was declared in the _helpers.tpl file, therefore, we just need to add a new line there, called app.fullName (remove lines 16 and 18 from the same file in the playground located at the end of this lesson). :
To find out how this change will affect our currently active Helm release we only need to run the helm diff upgrade command followed by the namespace and chart names. Also, to make sure Helm is checking the correct namespace, the --namespace flag has been added.
The helm diff upgrade command checks what has changed and prints it out in color showing what has been removed and what has been added, similar to the way Git does.
Another way this action can be useful is when we want to override values from the values.yaml file and not necessarily update the chart itself. Going back to our example, let’s say that we want to increase the number of replicas of a front-end service. In kanban-frontend.yaml, we need to add app.replicaCount with a new value (let’s say it’s 2).
Then the only thing that we need to do is to run the command that includes the --values flag followed by the name of a properties file:
The output will be as follows:
As we would expect, helm diff upgrade shows us all the changes that were made in the /templates folder and also the changes that were applied based on the values.yaml file.
The helm diff revision command#
Next, a very handy command is helm diff revision. It’s used for printing out the changes that were already applied. We can compare what has been changed between the two releases, e.g., the one currently running and the previous one. The only thing that we need to know is the number of revisions of a release that we’d like to compare.
To test it out, let’s install a new revision with changes in the _helpers.tpl file from the beginning of this lesson, as shown below:
As a result, we should have a new revision created:
The output will be as follows:
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Jan 3 superseded app-0.1.0 1.16.0 Install complete
2 Jan 3 deployed app-0.1.0 1.16.0 Upgrade complete
Now, if we want to compare both the revisions, we can simply run the following command:
Where:
kanban-frontend: This is the name of the release.1: This is the revision with which we would like to compare the latest one.--namespace kanban: This is added to specify the namespace in which the release is located.
The changes are pretty much the same as before, with one small difference—an annotation that tells us about the version of our application.
We have covered all the essential aspects of this lesson and this section of the course.We hope you feel comfortable with Helm by now and not only use Helm charts but also create your own.
Playground#
There is a playground below where we can test the commands from this lesson.
Just follow all the steps explained above, starting from uncommenting the part of the code located at the end of the_helpers.tpl file. Remove lines 16 and 18 and that’s it, we can follow all the steps from this lesson.
/
Helm Plug-Ins
Single vs. Multi Deployments Chart